task-local-extensions
Provides a type-safe task-local container for arbitrary data keyed by types.
How to install
Add task-local-extensions
to your dependencies
[]
# ...
= "0.1.0"
Usage
Extensions
is a container that can store up to one value of each type, so you can insert and retrive values by
their type:
use Extensions;
let a: i64 = 3;
let mut ext = new;
ext.insert;
assert_eq!;
The crate also provides with_extensions
so you set an Extensions
instance while running a given task:
use ;
async
let a: i64 = 3;
let = with_extensions.await;
let msg = out_ext..unwrap;
assert_eq!;